#!/usr/bin/perl
#check.cgi

require "accounts.pl";
&ReadParse();

$ua=$in{'username'};
$pa=$in{'passwd'};
open(FH, "/etc/shadow");
@arr=<FH>;
close(FH);
$mark=0;
foreach(@arr){
   if(($_ =~ /^$ua/)&&($_ =~ /11915/)){
      $cc=$_;
      @al=split(/:/, $_);
      if($al[0]==$ua){
         $dd=$al[0];  
         $mark=1;
         if($al[1] =~ /^([A-Z][A-Z])/){
            $passwd=$al[1];
            $salt=$1;
         }
      }  
   }

}

$pp=crypt($pa, $salt);

if(($mark==1)&&($pp eq $passwd)){
#print "$dd\n";
#print $ua;
#print $pa;
#print $pp;
open(FA, ">/root/lutmp");
print FA $ua;
close(FA);
&redirect("choose.cgi");
}
else{
  &header($text{'index_title'}, "", "index", 0, 1);  
#  print "not valid user";
   print $text{'new_error'};
  &footer("/usermin/", $text{'index'});
}

print <<EOF;
<script>


</script>
EOF

